<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="中科院软件所实习日志（LARVa）：从项目开始, python,machine learning,deep learning,html,css,c,c++,cpp,cmake,ros,linux,ubuntu">
    <meta name="description" content="本文是中科院软件所实习（LARVa项目）日志的第一篇，主要对实习的项目（LARVa）进行了介绍">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="referrer" content="no-referrer-when-downgrade">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>中科院软件所实习日志（LARVa）：从项目开始 | JackWang&#39;s Blog</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery-3.6.0.min.js"></script>

<meta name="generator" content="Hexo 5.4.2">
<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css">
<link rel="stylesheet" href="/css/prism-line-numbers.css" type="text/css"></head>



   <style>
    body{
       background-image: url(https://cdn.jsdelivr.net/gh/Tokisaki-Galaxy/res/site/medias/background.jpg);
       background-repeat:no-repeat;
       background-size: 100% 100%;
       background-attachment:fixed;
    }
</style>



<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">JackWang&#39;s Blog</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="" class="waves-effect waves-light">

      
      <i class="fas fa-book-reader" style="zoom: 0.6;"></i>
      
      <span>博客</span>
      <i class="fas fa-chevron-down" aria-hidden="true" style="zoom: 0.6;"></i>
    </a>
    <ul class="sub-nav menus_item_child ">
      
      <li>
        <a href="/tags">
          
          <i class="fas fa-tags" style="margin-top: -20px; zoom: 0.6;"></i>
          
	  <span>按标签归类文章</span>
        </a>
      </li>
      
      <li>
        <a href="/categories">
          
          <i class="fas fa-bookmark" style="margin-top: -20px; zoom: 0.6;"></i>
          
	  <span>按目录归类文章</span>
        </a>
      </li>
      
      <li>
        <a href="/archives">
          
          <i class="fas fa-archive" style="margin-top: -20px; zoom: 0.6;"></i>
          
	  <span>按日期分类文章</span>
        </a>
      </li>
      
    </ul>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>



<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">JackWang&#39;s Blog</div>
        <div class="logo-desc">
            
            JackWang的个人博客
            
        </div>
    </div>

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="javascript:;">
			
				<i class="fa-fw fas fa-book-reader"></i>
			
			博客
			<span class="m-icon"><i class="fas fa-chevron-right"></i></span>
		</a>
            <ul  style="background:  ;" >
              
                <li>

                  <a href="/tags " style="margin-left:75px">
				  
				   <i class="fa fas fa-tags" style="position: absolute;left:50px" ></i>
			      
                              <span>按标签归类文章</    span>

                  </a>
                </li>
              
                <li>

                  <a href="/categories " style="margin-left:75px">
				  
				   <i class="fa fas fa-bookmark" style="position: absolute;left:50px" ></i>
			      
                              <span>按目录归类文章</    span>

                  </a>
                </li>
              
                <li>

                  <a href="/archives " style="margin-left:75px">
				  
				   <i class="fa fas fa-archive" style="position: absolute;left:50px" ></i>
			      
                              <span>按日期分类文章</    span>

                  </a>
                </li>
              
            </ul>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        
    </ul>
</div>


        </div>

        
    </nav>

</header>

    
<script src="/libs/cryptojs/crypto-js.min.js"></script>
<script>
    (function() {
        let pwd = '';
        if (pwd && pwd.length > 0) {
            if (pwd !== CryptoJS.SHA256(prompt('抱歉，这篇文章并不想让所有人都看到，请输入授权密码观看')).toString(CryptoJS.enc.Hex)) {
                alert('密码错误，将返回主页！');
                location.href = '/';
            }
        }
    })();
</script>




<div class="bg-cover pd-header post-cover" style="background-image: url('https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601033238313.png')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">中科院软件所实习日志（LARVa）：从项目开始</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        padding: 35px 0 15px 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        padding-bottom: 30px;
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/%E5%AE%9E%E4%B9%A0%E6%97%A5%E8%AE%B0/">
                                <span class="chip bg-color">实习日记</span>
                            </a>
                        
                            <a href="/tags/%E4%B8%AD%E7%A7%91%E9%99%A2/">
                                <span class="chip bg-color">中科院</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/%E4%B8%AD%E7%A7%91%E9%99%A2%E5%AE%9E%E4%B9%A0%E6%97%A5%E8%AE%B0/" class="post-category">
                                中科院实习日记
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2023-05-29
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2023-06-01
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    3.1k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    10 分
                </div>
                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">

        

        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <p><img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601033238313.png" alt="LoongArch的爹：龙芯中科"></p>
<h2 id="一、还得从项目介绍开始"><a href="#一、还得从项目介绍开始" class="headerlink" title="一、还得从项目介绍开始"></a>一、还得从项目介绍开始</h2><p><code>PLCT</code>的实习是项目导向性，所以在开始前，还得介绍一下实习做的项目。主要内容来自于实习项目照片的<a target="_blank" rel="noopener" href="https://github.com/plctlab/weloveinterns/blob/master/open-internships.md">官方仓库</a>，项目编号：<code>BJ82</code>，要做的项目名称是：<code>LARVa</code></p>
<p>PS：虽然官方仓库确实有项目的介绍，不过这一系列文章兼具笔记的功能。所以是希望未来的可能的读者能够读懂的，所以会对项目的背景、任务等等进行补充介绍</p>
<h3 id="1-项目背景"><a href="#1-项目背景" class="headerlink" title="1. 项目背景"></a>1. 项目背景</h3><p><code>LARVa</code>项目主要有两大背景：</p>
<ul>
<li><code>LoongArch</code>架构</li>
<li><code>RISC-V</code>架构</li>
<li>模拟器</li>
</ul>
<h4 id="A-LoongArch架构"><a href="#A-LoongArch架构" class="headerlink" title="A. LoongArch架构"></a>A. <code>LoongArch</code>架构</h4><p>要介绍<code>LoongArch</code>，就得先介绍一下其他的指令集架构。目前，目前主流的指令集架构和特点分别是：</p>
<ol>
<li><code>x86</code>架构：<code>x86</code>架构由<code>Intel</code>开发，具有成熟的生态系统和软件支持。但是，<code>x86</code>架构是闭源的，不利于自主创新和技术研发。</li>
<li><code>ARM</code>架构：<code>ARM</code>架构由<code>ARM</code>公司开发，主要应用于移动设备（其实就是手机）、嵌入式系统和物联网，具有低功耗、高集成度的特点。但是，<code>ARM</code>架构也是闭源的，不利于自主创新和技术研发。</li>
<li><code>MIPS</code>架构：由<code>MIPS</code>由<code>MIPS</code>公司开发，主要应用于路由器、数字电视、游戏机等领域，具有高性能、低功耗的特点。同时，<code>MIPS</code>架构虽然现在开源了，但是过去还是和<code>arm</code>类似，是需要授权的。</li>
<li><code>Power</code>架构：<code>Power</code>架构由<code>IBM</code>开发，主要用于高性能计算和服务器领域，具有高性能、高可靠性的特点。但是，<code>Power</code>架构的成本较高，适用于高端市场，一般人接触不到</li>
<li><code>SPARC</code>架构：<code>SPARC</code>架构由<code>Oracle</code>公司开发，主要应用于高性能计算和服务器领域，具有高性能、高可靠性的特点。但是，<code>SPARC</code>架构的市场份额较小，所以软件啥的不太行，生态系统不如<code>x86</code>和<code>ARM</code>架构成熟。</li>
</ol>
<p><strong>目前流行的指令集，闭源的就不说了，太贵了。而即便是之前授权的、当前开源指令集，也是国外的，这个万一被卡脖子就不太好了</strong>。虽然开源授权协议是不牵扯国家政治，但是管理开源项目的开源组织、开源基金会却是被国家管理的。例如：</p>
<ul>
<li>前两天管理<code>Python</code>包的<code>PyPI</code>就收到了US法院传票，要求上交用户（包制作者）的信息。</li>
<li>再比如稍后要介绍的<code>RISC-V</code>开源基金会的注册地址为了规避掉这个风险，注册地址从US搞到了瑞士。</li>
</ul>
<p>所以其实说白了，指令集这种底层的东西，不掌握在自己手里，终究是有风险的。与此类似的，还有操作系统、数据库、编译器……</p>
<p><strong>但是话说回来，作为计算机底层中的底层，指令集架构这个玩意出事情，那问题就太大了</strong>。而且，对于国产<code>CPU</code>发展，过去20多年中始终有两个问题无法解决，那就是要走自主之路还是走兼容之路，选择前者就意味着要重新建立一套生态系统，难度极大，选择后者的话可以兼容目前的<code>ARM</code>或者<code>x86</code>生态，但核心技术不能掌握在自己手里，不能自主。所以，国内的龙芯公司（<code>Loongson</code>）就推出了<code>LoongArch</code>架构。<code>LoongArch</code>指令集拥有2500多条自主指令，还可以翻译<code>MIPS</code>、<code>ARM</code>及<code>x86</code>指令。相当于</p>
<p><code>LoongArch</code>架构的目的有两个：</p>
<ul>
<li>一是因为<code>LoongArch</code>架构是国内自主研发的一种处理器架构，所以目的之一就是降低对国外技术的依赖、提高国家信息安全</li>
<li>二是<code>MIPS</code>架构有一些设计的缺陷，所以作为后来者，<code>LoongArch</code>架构在处理器的指令集、内存管理、缓存一致性等方面进行了优化和改进</li>
</ul>
<p>目前，龙芯已经推出了多款基于<code>LoongArch</code>架构的处理器，应用于服务器、工作站、嵌入式系统等领域。</p>
<blockquote>
<p>比较搞笑的是，<code>MIPS</code>公司后来放弃了<code>MIPS</code>指令集架构，转而开发基于后面介绍的<code>RISC-V的</code>处理器😂。所以说<code>LoongArch</code>这个，有那么点小尴尬😂</p>
<p><img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601033104233.png" alt="MIPS官网已经是Taking RISC-V to new heights了😂"></p>
</blockquote>
<p><strong>但是计算机领域的新事物，面临的最关键的问题其实就是生态系统问题</strong>。<code>x86</code>和<code>arm</code>发展了这么多年，基本上什么软件都可以使用，而<code>LoongArch</code>才出来没几年（相比于<code>x86</code>和<code>arm</code>），所以缺少配套的软硬件生态系统。所以其实，我们<code>LARVa</code>这个项目其实就是为<code>LoongArch</code>的生态系统中添砖加瓦</p>
<h4 id="B-RISC-V架构"><a href="#B-RISC-V架构" class="headerlink" title="B. RISC-V架构"></a>B. <code>RISC-V</code>架构</h4><p>说到<code>RISC-V</code>架构，就得介绍介绍他的历史</p>
<p><code>RISC-V</code>架构最初是由加州大学伯克利分校的一位教授David Patterson和他的学生Andrew Waterman在2010年提出的。他们认为，当时的处理器架构设计存在着许多限制。</p>
<blockquote>
<p>PS：那个时候指令集架构基本都是不开源的</p>
</blockquote>
<p>所以他们需要一种更加灵活、开放的架构来推动计算机技术的进步。因此，他们基于精简指令集（<code>RISC</code>）的思想，设计了一种全新的指令集架构，即<code>RISC-V</code>。</p>
<p>自2010年以来，<code>RISC-V</code>架构得到了越来越多的关注和支持。2014年，<code>RISC-V</code>基金会成立，旨在促进<code>RISC-V</code>架构的发展和推广。因为<code>RISC-V</code>是开源的，所以非常火热，甚至干死了老前辈，倒逼<code>MIPS</code>、<code>SPARC</code>这类指令集架构开源。</p>
<p>截至目前，<code>RISC-V</code>已经成为了一种广泛使用的指令集架构，并且在各种应用领域都有着广泛的应用。例如，<code>RISC-V</code>已经被用于物联网、人工智能、移动设备、服务器等各种领域的处理器设计中。</p>
<p><img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601033343804.png" alt="RISC-V基金会官网"></p>
<h4 id="C-模拟器"><a href="#C-模拟器" class="headerlink" title="C. 模拟器"></a>C. 模拟器</h4><blockquote>
<p> 我们上面介绍了<code>LoongArch</code>和<code>RISC-V</code>这两种指令集架构，那么这两者到底有什么关系呢？其实它们的交集就是我们的<code>LARVa</code>项目，不过在正式介绍<code>LARVa</code>项目前，需要先介绍一下模拟器。</p>
</blockquote>
<p><code>模拟器</code>（<code>emulator</code>）是一种软件或硬件系统，它可以模拟另一个计算机系统的行为。直观的理解，模拟器就是一个能从硬件CPU、磁盘等等设备开始模拟的虚拟机。模拟器最大的好处就是可以在自己的计算机上运行其他计算机系统的软件，而无需实际拥有该系统的硬件。例如模拟器通常会模拟目标系统的处理器、内存、输入输出设备等硬件，以及操作系统和应用软件等软件环境。</p>
<p>这样说比较抽象，举一个例子：</p>
<ul>
<li>我们是穷逼，只有一台<code>x86</code> CPU的机器。</li>
<li>但是我们工作/学习的需要，我们需要编写运行在<code>RISC-V</code>CPU的机器上的程序</li>
<li>所以这个时候，我们可以用模拟器在自己的机器上模拟一台有<code>RISC-V</code>CPU的计算机</li>
<li>这样的话，就可以在自己的自己的机器上去测试未来将运行在<code>RISC-V</code>CPU上的程序</li>
</ul>
<p><strong>模拟器最大的好处就是能从CPU、内存这些开始模拟，所以其实就是完完全全在你电脑上模拟一个包括硬件在内的目标计算机</strong>，这就非常非常有用。例如，模拟器常见的应用场景有：</p>
<ul>
<li>开发和测试新的操作系统、应用软件或游戏，因为它可以模拟目标系统的环境，让开发人员进行测试和调试。</li>
<li>旧系统的保护和维护，因为它可以让用户在现代计算机上运行旧的软件，而无需拥有旧系统的硬件。</li>
<li>模拟器还可以用于教育和学习，因为它可以让学生学习和理解其他计算机系统的工作原理。</li>
</ul>
<h3 id="2-项目任务"><a href="#2-项目任务" class="headerlink" title="2. 项目任务"></a>2. 项目任务</h3><p>介绍了模拟器之后，结合我们前面介绍的<code>LoongArch</code>和<code>RISC-V</code>的内容，其实我们<code>LARVa</code>这个项目要干的事情就很清楚了：</p>
<blockquote>
<p>开发一个能够运行在<code>LoongArch</code>架构上的模拟器，这个模拟器能够模拟<code>RISC-V</code>CPU。</p>
</blockquote>
<p>有了这个模拟器能干嘛呢？我觉得能干的事情之一就是未来我们有钱之后，买一台<code>LoongArch</code>CPU的计算机，我们就能够使用我们写的模拟器去模拟运行<code>RISC-V</code>的CPU（<del>误</del>）</p>
<p><strong>严谨的说，我们做的事情其实是为国产的<code>LoongArch</code>架构的生态系统添砖加瓦，为国产开源事业贡献自己的力量（Hoorayヾ(@^▽^@)ノ）</strong></p>
<h3 id="3-项目内容"><a href="#3-项目内容" class="headerlink" title="3. 项目内容"></a>3. 项目内容</h3><blockquote>
<p>以下介绍Copy自Github的<a target="_blank" rel="noopener" href="https://github.com/plctlab/weloveinterns/blob/master/open-internships.md#bj82-%E5%AE%9E%E7%8E%B0%E5%9F%BA%E4%BA%8E-loongarch-%E6%9E%B6%E6%9E%84%E7%9A%84-risc-v-%E6%A8%A1%E6%8B%9F%E5%99%A8-larva-%E8%BF%9B%E8%A1%8C%E4%B8%AD%E5%90%8D%E9%A2%9D-1">项目官方</a>介绍，加上我的一些心里想法</p>
</blockquote>
<p>工作内容：</p>
<ul>
<li><p>与mentor协作开发基于<code>LoongArch</code>架构的<code>RISC-V</code>模拟器<code>LARVa</code>。</p>
<blockquote>
<p>这个mentor有点难顶TAT，我打电话联系的时候给我说他平时有本职工作，我入职实习之后投入的时间比他还多。。。。估计我得好好肝了</p>
</blockquote>
</li>
<li><p>该项目目前使用<code>Rust</code>语言开发，需要有一定<code>Rust</code>基础。由于<code>LoongArch</code>在<code>Rust</code>上游支持很新（截至该职位发布时甚至不完整），有很大机率涉及直接向<code>Rust</code>上游贡献适配代码。</p>
<blockquote>
<p>咋说呢，<code>Rust</code>这东西我一直都是久闻其名，和<code>go</code>一样都是处于想学没来得及学的叠加态。还得往上游贡献代码，感觉挺有意思，干tnnd！</p>
</blockquote>
</li>
<li><p>目前路线图上的短期目标包括实现一个不依赖<code>LoongArch</code>的解释执行后端，用于校验<code>RISC-V</code>模拟语义，因此暂时没有<code>LoongArch</code>知识或硬件也 okay。</p>
<blockquote>
<p>我：解释执行后端？？校验模拟语义？？？？喵喵喵喵？？？</p>
</blockquote>
</li>
<li><p>在<code>Rust</code>上游支持开发<code>LoongArch UEFI</code>应用之前，工作重心会放在实现<code>linux-user</code>模拟上。否则会开始基于<code>RustSBI</code>实现完整的<code>RISC-V</code>系统级模拟。（这也可能通过一定的方式先在<code>Linux</code>环境模拟，但目前没有这方面想法。）</p>
<blockquote>
<p><code>UEFI</code>、<code>RustSBI</code>、<code>linux-user</code>这些东西我都听过，咋整一块我就看不懂了</p>
</blockquote>
</li>
<li><p>mentor 会和你一同学习制作架构模拟器。</p>
<blockquote>
<p>寄中寄</p>
</blockquote>
</li>
</ul>
<p><strong>我的评价是：寄（<del>误</del>)。</strong>哈哈，开个玩笑。感觉这个项目挺有意思的，感觉最有意思的部分就是向<code>RUST</code>上游贡献<code>LoongArch</code>的代码，这个有点牛逼。啥时候我能给<code>Linux</code>贡献一下<code>LoongArch</code>的代码，回头和朋友吹牛也能说我是<code>Linux</code>内核代码贡献者😂</p>
<p>好好肝吧，咱啥都缺，最缺钱，尤其是看到好配置的机器时候，不过最不缺的就是肝，冲！干tnd！</p>
<h2 id="二、个人学习Road-Map"><a href="#二、个人学习Road-Map" class="headerlink" title="二、个人学习Road Map"></a>二、个人学习Road Map</h2><p>这个Road Map和项目开发的Road Map没啥关系，是我目前评估出来的为了做这个项目，我需要学的一些东西。</p>
<ol>
<li><code>Rust</code>语言。咱多少还是学了五六种语言的，这个速成一下问题不大</li>
<li><code>QEMU</code>源码。得去看看<code>QEMU</code>源码，了解一下模拟器实现的大概原理，不然还没法写出来自己的模拟器</li>
<li><code>LoongArch</code>指令集。这个肯定得去看看，不过感觉问题不大，好歹咱还是学过x86、ARM、RISC-V的，差不多就中断啊、IO啊、MMU啊那些老三样</li>
<li><code>UEFI</code>。之前自己写的操作系统是直接<code>MBR</code>分区里的<code>loader</code>，当时偷懒了图开发方便，没学<code>UEFI</code>。这会多少得学学了</li>
<li><code>RustSBI</code>。之前自己写的<code>RISC-V</code>的操作系统，<code>SBI</code>是自己写的，虽然知道<code>RustSBI</code>的功能和作用，但是具体还真没用过，得去学学</li>
<li>其他。<ul>
<li>后续再添加</li>
<li>目前水平有限，只能想到这么多</li>
<li>有的东西还不太懂，例如：“依赖<code>LoongArch</code>的解释执行后端”这是啥现在都搞不懂，得先学习上面的前置知识。</li>
</ul>
</li>
</ol>
<p>根据这五个milestone的依赖关系，准备按照下面的顺序学习：</p>
<ul>
<li>Branch 1：学习<code>Rust</code>语言</li>
<li>Branch 2：学习<code>LoongArch</code>指令集架构</li>
<li>Branch 3：看<code>QEMU</code>源码</li>
</ul>
<p>PS：三个Branch之间是并行的</p>
<p><img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601041603904.png" alt="Milestone和LARVa之间的依赖关系图" style="zoom:33%;"></p>
<p>最后嘛，希望工钱能多点，或者换成护肝片也不错😂</p>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">Jack Wang</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://jackwang0107.github.io/2023/05/29/zhong-ke-yuan-ruan-jian-suo-shi-xi-larva-1/">https://jackwang0107.github.io/2023/05/29/zhong-ke-yuan-ruan-jian-suo-shi-xi-larva-1/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">Jack Wang</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/%E5%AE%9E%E4%B9%A0%E6%97%A5%E8%AE%B0/">
                                    <span class="chip bg-color">实习日记</span>
                                </a>
                            
                                <a href="/tags/%E4%B8%AD%E7%A7%91%E9%99%A2/">
                                    <span class="chip bg-color">中科院</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.png" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.jpg" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2023/05/30/zhong-ke-yuan-ruan-jian-suo-shi-xi-larva-2/">
                    <div class="card-image">
                        
                        <img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/image-20230601042403179.png" class="responsive-img" alt="Rust语言从入门到入土 1：Rust的开始">
                        
                        <span class="card-title">Rust语言从入门到入土 1：Rust的开始</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            本文是中科院软件所实习（LARVa项目）日志的第二篇，主要记录了我学习Rust语言的相关内容。本文主要介绍了什么是Rust，以及Rust开发环境配置
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2023-05-30
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E4%B8%AD%E7%A7%91%E9%99%A2%E5%AE%9E%E4%B9%A0%E6%97%A5%E8%AE%B0/" class="post-category">
                                    中科院实习日记
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/%E5%AE%9E%E4%B9%A0%E6%97%A5%E8%AE%B0/">
                        <span class="chip bg-color">实习日记</span>
                    </a>
                    
                    <a href="/tags/%E4%B8%AD%E7%A7%91%E9%99%A2/">
                        <span class="chip bg-color">中科院</span>
                    </a>
                    
                    <a href="/tags/Rust/">
                        <span class="chip bg-color">Rust</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2023/05/29/bian-yi-yuan-li-2/">
                    <div class="card-image">
                        
                        <img src="https://jack-1307599355.cos.ap-shanghai.myqcloud.com/51Bv6BJig-L.jpg" class="responsive-img" alt="编译原理 2：语言及其文法">
                        
                        <span class="card-title">编译原理 2：语言及其文法</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            本章是编译原理的第二章，主要对语言进行数学上形式化的定义，即定义了语言的文法
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2023-05-29
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/" class="post-category">
                                    编译原理
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/">
                        <span class="chip bg-color">编译原理</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>


<script>
    $('#articleContent').on('copy', function (e) {
        // IE8 or earlier browser is 'undefined'
        if (typeof window.getSelection === 'undefined') return;

        var selection = window.getSelection();
        // if the selection is short let's not annoy our users.
        if (('' + selection).length < Number.parseInt('120')) {
            return;
        }

        // create a div outside of the visible area and fill it with the selected text.
        var bodyElement = document.getElementsByTagName('body')[0];
        var newdiv = document.createElement('div');
        newdiv.style.position = 'absolute';
        newdiv.style.left = '-99999px';
        bodyElement.appendChild(newdiv);
        newdiv.appendChild(selection.getRangeAt(0).cloneContents());

        // we need a <pre> tag workaround.
        // otherwise the text inside "pre" loses all the line breaks!
        if (selection.getRangeAt(0).commonAncestorContainer.nodeName === 'PRE' || selection.getRangeAt(0).commonAncestorContainer.nodeName === 'CODE') {
            newdiv.innerHTML = "<pre>" + newdiv.innerHTML + "</pre>";
        }

        var url = document.location.href;
        newdiv.innerHTML += '<br />'
            + '来源: JackWang&#39;s Blog<br />'
            + '文章作者: Jack Wang<br />'
            + '文章链接: <a href="' + url + '">' + url + '</a><br />'
            + '本文章著作权归作者所有，任何形式的转载都请注明出处。';

        selection.selectAllChildren(newdiv);
        window.setTimeout(function () {bodyElement.removeChild(newdiv);}, 200);
    });
</script>


<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('2'),
            headingSelector: 'h1, h2, h3, h4, h5, h6'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h1, h2, h3, h4, h5, h6').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>


<script src="https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
    MathJax.Hub.Config({
        tex2jax: {inlineMath: [['$', '$'], ['\\(', '\\)']]}
    });
</script>



    <footer class="page-footer bg-color">
    

    <div class="container row center-align"
         style="margin-bottom: 15px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2021-2023</span>
            
            <a href="/about" target="_blank">Jack Wang</a>
            <!-- |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a> -->
            <!-- |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a> -->
            <br>
            
                &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                        class="white-color">603.8k</span>
            
            
            
                
            
            
                <span id="busuanzi_container_site_pv">
                &nbsp;|&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;
                    <span id="busuanzi_value_site_pv" class="white-color"></span>
            </span>
            
            
                <span id="busuanzi_container_site_uv">
                &nbsp;|&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;
                    <span id="busuanzi_value_site_uv" class="white-color"></span>
            </span>
            
            <br>

            <!-- 运行天数提醒. -->
            
                <span id="sitetime"> Loading ...</span>
                <script>
                    var calcSiteTime = function () {
                        var seconds = 1000;
                        var minutes = seconds * 60;
                        var hours = minutes * 60;
                        var days = hours * 24;
                        var years = days * 365;
                        var today = new Date();
                        var startYear = "2021";
                        var startMonth = "11";
                        var startDate = "12";
                        var startHour = "0";
                        var startMinute = "0";
                        var startSecond = "0";
                        var todayYear = today.getFullYear();
                        var todayMonth = today.getMonth() + 1;
                        var todayDate = today.getDate();
                        var todayHour = today.getHours();
                        var todayMinute = today.getMinutes();
                        var todaySecond = today.getSeconds();
                        var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                        var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                        var diff = t2 - t1;
                        var diffYears = Math.floor(diff / years);
                        var diffDays = Math.floor((diff / days) - diffYears * 365);

                        // 区分是否有年份.
                        var language = 'zh-CN';
                        if (startYear === String(todayYear)) {
                            document.getElementById("year").innerHTML = todayYear;
                            var daysTip = 'This site has been running for ' + diffDays + ' days';
                            if (language === 'zh-CN') {
                                daysTip = '本站已运行 ' + diffDays + ' 天';
                            } else if (language === 'zh-HK') {
                                daysTip = '本站已運行 ' + diffDays + ' 天';
                            }
                            document.getElementById("sitetime").innerHTML = daysTip;
                        } else {
                            document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                            var yearsAndDaysTip = 'This site has been running for ' + diffYears + ' years and '
                                + diffDays + ' days';
                            if (language === 'zh-CN') {
                                yearsAndDaysTip = '本站已运行 ' + diffYears + ' 年 ' + diffDays + ' 天';
                            } else if (language === 'zh-HK') {
                                yearsAndDaysTip = '本站已運行 ' + diffYears + ' 年 ' + diffDays + ' 天';
                            }
                            document.getElementById("sitetime").innerHTML = yearsAndDaysTip;
                        }
                    }

                    calcSiteTime();
                </script>
            
            <br>
            
                <span id="icp"><img src="/medias/icp.png"
                                    style="vertical-align: text-bottom;"/>
                <a href="https://beian.miit.gov.cn" target="_blank">陕ICP备2021014294号-1</a>
            </span>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/jackwang0108" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:2232123545@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=2232123545" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 2232123545" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    

    
        
        <script type="text/javascript">
            // 只在桌面版网页启用特效
            var windowWidth = $(window).width();
            if (windowWidth > 768) {
                document.write('<script type="text/javascript" src="/libs/others/sakura.js"><\/script>');
            }
        </script>
    

    <!-- 雪花特效 -->
    

    <!-- 鼠标星星特效 -->
    

     
        <script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
        <script src="/libs/others/TencentCaptcha.js"></script>
        <button id="TencentCaptcha" data-appid="xxxxxxxxxx" data-cbfn="callback" type="button" hidden></button>
    

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    

    

    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
